﻿@model Apps.Models.PUB_CAR
@using Apps.Web.Core;
@using Apps.Common;
@using Apps.Models.PUB;
@using Apps.Web;
@using Apps.Locale;
@using Apps.Models.Sys;
@{
    ViewBag.Title = "修改";
    Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
    List<permModel> perm = null;
}


<style type="text/css">

    .Newformtable th {
        width: 130px;
        height: 35px;
        font-weight: bold;
    }

    .Newformtable td {
        width: 180px;
    }

    input[type="text"] {
        width: 92%;
    }

    select {
        width: 98%;
    }

    textarea {
        width: 98%;
    }
</style>


<script type="text/javascript">
    $(function () {
        $("#CAR_SIZE").val($("#CAR_SIZE").val() == '' ? '0-1.8,1.5*1.8-2.8,1.9*2.8-4.6,1.5' : $("#CAR_SIZE").val());
    $("#btnSave").click(function () {
        var str = $("#CAR_SIZE").val().split("*");
        if (str != "") {

            for (var i = 0; i < str.length; i++) {
                var patternsp = /(?:[\.]{1}[0-9]+)?/;
                var fuhao = str[i].split(patternsp);
                var str2 = str[i].split(",");
                var str3 = str2[0].split("-");

                if (str2[1] > 10 || str2[1] < 0 || str3[0] > 10 || str3[0] < 0 || str3[1] > 15 || str3[1] < 0) {
                    window.parent.frameReturnByMes("车厢尺寸输入的数值过大或过小");
                    return false;
                }

                if (fuhao[1] != "-" || !(fuhao[3] == "," || fuhao[4] == ",")) {
                    window.parent.frameReturnByMes("车厢尺寸输入的符号格式有误");
                    return false;
                }


                if (isNaN(str2[1]) || isNaN(str3[0]) || isNaN(str3[1])) {
                    window.parent.frameReturnByMes("车厢尺寸输入的数字格式有误");
                    return false;
                }

            }


            $.ajax({
                url: "@Url.Action("Edit")",
                type: "Post",
            data: $("form").serialize(),
            dataType: "json",
            success: function (data) {
                if (data.type == 1) {
                    window.parent.frameReturnByMes(data.message);
                    window.parent.frameReturnByReload(false);
                    window.parent.frameReturnByClose();
                }
                else {
                    window.parent.frameReturnByMes(data.message);
                }
            }
                   
        });
            return false;
       

        }
        else {
           
            window.parent.frameReturnByMes("请填写车辆尺寸！");
            
        }
        return false;
    });
    $("#btnReturn").click(function () {
         window.parent.frameReturnByClose();
    });
});
</script>
<div class="mvctool bgb">
@Html.ToolButton("btnSave", "fa fa-save", Resource.Save,ref perm, "Save", true)
@Html.ToolButton("btnReturn", "fa fa-reply", Resource.Reply,false)
</div>
@using (Html.BeginForm())
{
    @Html.HiddenFor(model => model.CAR_ID)
    @Html.HiddenFor(model => model.REGISTER_USER_ID)
    @Html.HiddenFor(model => model.REGISTER_TIME) 
    <table class="Newformtable">
        <tbody>
            <tr>
                <th>
                    @Html.LabelFor(model => model.LPR,0)：
                </th>
                <td>
                    @Html.EditorFor(model => model.LPR)
                </td>
                <th>
                    @Html.LabelFor(model => model.RFID,0)：
                </th>
                <td>
                    @Html.EditorFor(model => model.RFID)
                </td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.DRIVER_IDCARD,0)：
                </th>
                <td>
                    @Html.EditorFor(model => model.DRIVER_IDCARD)
                </td>
                <th>
                    @Html.LabelFor(model => model.DRIVER_PHONE,0)：
                </th>
                <td>
                    @Html.EditorFor(model => model.DRIVER_PHONE)
                </td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.SPECIFIED_WEIGHT,0)：
                </th>
                <td>
                    @Html.EditorFor(model => model.SPECIFIED_WEIGHT)
                </td>
                <th>
                    @Html.LabelFor(model => model.TARE,0)：
                </th>
                <td>
                    @Html.EditorFor(model => model.TARE)
                </td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.TOTLE_LENGTH,0)：
                </th>
                <td>
                    @Html.EditorFor(model => model.TOTLE_LENGTH)
                </td>
                <th>
                    @Html.LabelFor(model => model.LENGTH,0)：
                </th>
                <td>
                    @Html.EditorFor(model => model.LENGTH)
                </td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.TOTLE_WIDTH,0)：
                </th>
                <td>
                    @Html.EditorFor(model => model.TOTLE_WIDTH)
                </td>
                <th>
                    @Html.LabelFor(model => model.WIDTH,0)：
                </th>
                <td>
                    @Html.EditorFor(model => model.WIDTH)
                </td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.HEIGHT,0)：
                </th>
                <td>
                    @Html.EditorFor(model => model.HEIGHT)
                </td>
                <th>
                    @Html.LabelFor(model => model.POSTIONS,0)：
                </th>
                <td>
                    @Html.EditorFor(model => model.POSTIONS)
                </td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.CAR_SIZE, 0)：
                </th>
                <td colspan="2">
                    @Html.EditorFor(model => model.CAR_SIZE)
                </td>
            </tr>
            <tr>
                <th>
                    @Html.LabelFor(model => model.STATUS,0)：
                </th>
                <td colspan="3">
                    @Html.DropDownListFor(model =>model.STATUS, ViewBag.CarStatus as SelectList)
                </td>
            </tr>
        </tbody>
    </table>
@Html.ValidationSummary()
}

